//
// Created by 32513 on 25-4-7.
//

#ifndef MOTOR_H
#define MOTOR_H
#include <stdint.h>
// #include "stm32f4xx_hal_tim.h"
#include "tim.h"

typedef struct
{
    uint8_t Direction;
    uint16_t enc1,enc1_old;
    int16_t enc2 ;
    int32_t enc;
    int32_t last_enc;
    int32_t error_enc;
    uint32_t now_time;
    uint32_t last_time;
    uint32_t error_time;
    TIM_HandleTypeDef *motor_htim;
    float Speed;
} motor_measure_t;

void Motor_Init(void);
void Motor_Control(TIM_HandleTypeDef *motor_htim, uint32_t channel,float Speed);
void Get_Motor_Speed(motor_measure_t* motor_L_measure);

#endif //MOTOR_H
